package com.nbsaas.boot.vipcard.rest.convert;

import com.nbsaas.boot.vipcard.data.entity.VipCard;
import com.nbsaas.boot.vipcard.api.domain.simple.VipCardSimple;

import com.nbsaas.boot.rest.api.Converter;

/**
* -列表对象转换器
*/

public class VipCardSimpleConvert implements Converter<VipCardSimple, VipCard> {




@Override
public VipCardSimple convert(VipCard source) {
    VipCardSimple result = new VipCardSimple();


               try {
                   if(source.getOwner()!=null){
                       result.setOwner(source.getOwner().getId());
                   }
                } catch (Exception ignored) { }

                result.setBeginDate(source.getBeginDate());

                try {
                    if(source.getCard()!=null){
                        result.setCardName(source.getCard().getName());
                    }
                } catch (Exception ignored) { }


                try {
                    if(source.getOwner()!=null){
                        result.setOwnerName(source.getOwner().getName());
                    }
                } catch (Exception ignored) { }

                result.setEndDate(source.getEndDate());
                result.setState(source.getState());
                result.setId(source.getId());
                result.setCardNo(source.getCardNo());
                result.setAddDate(source.getAddDate());

               try {
                   if(source.getCard()!=null){
                       result.setCard(source.getCard().getId());
                   }
                } catch (Exception ignored) { }

                result.setLastDate(source.getLastDate());


    return result;
}

}